﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;

namespace TsCore
{
    [Table("Teams")]
    public class Team
    {
        [Key]
        public Int32 TeamId { get; set; }
        [MaxLength(255)]
        public String Name { get; set; }
        [MaxLength(255)]
        public String Image { get; set; }
        public Boolean IsDummyTeam { get; set; }
        public virtual List<Comment> Comments { get; set; }
        public virtual List<TsUser> Followers { get; set; }

        public virtual Sport Sport { get; set; }

        public Team()
        {
        }

        public Team(String name, String image)
        {
            this.Name = name;
            this.Image = image;
            this.Comments = new List<Comment>();
            this.IsDummyTeam = false;
        }

        public void addComment(Comment comm)
        {
            Comments.Add(comm);
            this.IsDummyTeam = false;
        }
        
        public override bool Equals(object obj)
        {
            return ((Team)obj).TeamId == this.TeamId;
        }

        public override string ToString()
        {
            return this.Name;
        }
    }
}
